package com.gaber.springbootorderrabbitmqconsumer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author gaber
 * @date 2023/9/18 18:19:02
 * @description TODO
 */
@Configuration
public class DirectRabbitMqConfiguration {
    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange("direct_order_exchange", true, false);
    }

    @Bean
    public Queue directsmsQueue() {
        return new Queue("sms.direct.queue", true);
    }

    @Bean
    public Queue directduanxinQueue() {
        return new Queue("duanxin.direct.queue", true);
    }

    @Bean
    public Queue directemailQueue() {
        return new Queue("email.direct.queue", true);
    }

    @Bean
    public Binding directsmsBingding() {
        return BindingBuilder.bind(directsmsQueue()).to(directExchange()).with("sms");
    }

    @Bean
    public Binding directduanxinBingding() {
        return BindingBuilder.bind(directduanxinQueue()).to(directExchange()).with("duanxin");
    }

    @Bean
    public Binding directemailBingding() {
        return BindingBuilder.bind(directemailQueue()).to(directExchange()).with("email");
    }
}
